<template>
  <div>
     <van-button type="primary"  @click="fh" size="mini">返回</van-button>
    <h2>搜索的结果是：</h2>
    <div class="q1" v-for="item in result" :key="item">
      <img :src="item.img" /> <span>{{ item.title }}</span>
      <p>{{item.titl}}</p>
      <p>{{item.name}}</p>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      list: [],
      result: [],
    };
  },
  mounted() {
    this.$axios.get("lists.json").then((res) => {
      this.list = res.data.data;
      this.getres();
    });
  },
  methods: {
    getres() {
      let res = this.list.filter((item) => {
        return item.titl.includes(this.$route.query.value);
      });
      this.result = res;
    },
    fh(){
      this.$router.push({path:"/fa"})
    }
  },
};
</script>
<style  scoped>
img{
  width: 50px;
  height: 50px;
  float: left;
  border-radius: 100%;
  margin: 10px;
}
span{
  float: left;
  line-height: 70px;
  margin-left: 30px;
}
.q1{
  width: 356px;
  height: 100px;
  border: 1px solid  orange;
  margin-top: 10px;
}
</style>